package com.kwok.openplatform.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kwok.openplatform.dao.RouterDao;
import com.kwok.openplatform.entity.Router;
import com.kwok.openplatform.service.RouterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 路由表(Router)表服务实现类
 *
 * @author Kwok
 * @since 2024-07-21 18:31:39
 */
@Service
public class RouterServiceImpl implements RouterService {

    @Autowired
    private RouterDao routerDao;

    @Override
    public PageInfo<Router> queryRouters(Integer page, Integer limit, Router router) {
        PageHelper.startPage(page,limit);
        List<Router> list = routerDao.selectRouters(router);
        PageInfo<Router> pageInfo = new PageInfo<Router>(list);
        return pageInfo;
    }

    @Override
    public Integer saveRouter(Router router) {
        return routerDao.insertRouter(router);
    }

    @Override
    public Integer updateRouterById(Router router) {
        return routerDao.updateRouterById(router);
    }

    @Override
    public Integer removeRouterById(Integer id) {
        return routerDao.deleteRouterById(id);
    }

    @Override
    public Integer batchRemoveRouterById(Integer... ids) {
        return routerDao.batchDeleteRouterById(ids);
    }

}

